# cmake_minimum_required(VERSION <specify CMake version here>)
cmake_minimum_required(VERSION 2.8)
project(tree C)

macro(use_c99)
    if (CMAKE_VERSION VERSION_LESS "3.1")
        if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
            set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
        endif ()
    else()
        set(CMAKE_C_STANDARD 99)
    endif ()
endmacro(use_c99)

set(CMAKE_C_STANDARD 99)

include_directories(src)

set(cfile
        src/tree.c
        src/http_alloc.c)
set(test
        test.c)
add_executable(${PROJECT_NAME} ${cfile} ${test})

use_c99()